<include file="Public/newset-header" title="应用设置" />
<link rel="stylesheet" href="__STATIC__/css/add.css">
<link rel="stylesheet" href="__STATIC__/css/cropper.min.css">
<link rel="stylesheet" href="__STATIC__/css/sitelogo.css">
<style type="text/css">
    .avatar-btns button{height: 35px;}
    @media (max-width:380px) {
        .text-right{padding: 0;}
        .app-set-abs{padding: 0;}
        .app-btns{width:100%;}
        .app-btns a{width:100%;}
    }
</style>
<div class="hint-copy">
    <p><i class="fa fa-warning"></i>已成功复制链接,请直接粘贴.</p>
</div>
<div class="container" style="padding-bottom:40px;">
    <ul class="breadcrumb">
        <li><a href="{:U('Index/index')}">首页</a></li>
        <li><a href="{:U('Index/index')}">上传应用</a></li>
        <li class="active">应用设置</li>
    </ul>
    <form class="reg-page sky-form" enctype="multipart/form-data" id="form" method="POST" action="{:U('index/updateinfo')}">
    <div class="app-set row" style="position:relative;">

        <div class="app-left col-sm-6 col-lg-2">
        <div class="reg-header">
            <p>
                <if condition="$info.zxlogo neq '' ">
                    <img src="__IMG__{$info.zxlogo}" class="img-rounded" width="100" height="100" />
                    <else />
                    <img src="data:image/png;base64,{$info.hslogo}" class="img-rounded" width="100" height="100" />
                </if>
            </p>
            <p style="text-align: center;margin-top: 10px;"><a onclick="fileSelect();" style="cursor:default;background: #268df7;color: #fff;padding: 5px 10px;">更改图标</a></p>
            <p id="imgppp" style="display:none;text-align:center;"><input type="file" name="fileToUpload" id="fileToUpload" onchange="fileSelected();"></p>
        </div>
    </div>
        <div class="col-xs-12 col-lg-6">
            <div class="adjust-box">
                <div class="app-tag">
                    <span id="generalize-url">www.qq6789.com/a/{$info.shorturl}</span>
                    <i id="copyBT" class="fa fa-copy"></i>
                    <!-- <span>Android</span> -->
                    <!-- <span>PackageName<b>com.huoyun.app</b></span> -->
                </div>
                <div class="app-nav">
                    <ul>
                        <li class="on"><a href="javascript:;"><i class="fa fa-file"></i>基本信息</a></li>
                        <li><a href="{:U('Index/myhebing',array('id'=>$info['id']))}"><i class="fa fa-cubes"></i>应用合并</a></li>
                        <li><a href="{:U('Index/appinfo',array('id'=>$info['id']))}"><i class="fa fa-bar-chart"></i>高级统计</a></li>
                        <li><a href="{:U('UrlAnalysis/index')}"><i class="fa fa-paper-plane"></i>应用推广</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="col-xs-6 col-lg-4 app-set-abs">
            <div class="app-btns">
                <a href="{:U('Index/index')}" class="on" style="margin-bottom:10px;"><i class="fa fa-cloud-upload"></i>上传新版本</a>
                <a href="/a/{$info.shorturl}" target="_blank" ><i class="fa fa-eye"></i>预览</a>
            </div>
        </div>
    </div>

    <div class="row">



        <div class="small-padding">
           <input type="hidden" value="{$info.ext}" name="ext" >
            <section class="change" style="padding:50px 0;">
                <div class="loading" aria-label="Loading" role="img" tabindex="-1"></div>
                <section class="row">
                    <label class="col-xs-3 col-lg-3 text-right">APP名称</label>
                    <label class="col-xs-9 col-lg-7"><input type="text" placeholder="名称" name="nickname" value="{$info.nickname}"></label>
                </section>
                <div class="row"><label class="col-xs-3 col-lg-3 text-right"></label><label class="col-lg-3 hidden-sm hidden-xs" style="font-weight:100;">支持修改APP名字</label></div>
				<?php
					$a = $info["ext"];
					if($a=='ipa'){
				?>
				<section class="row">
                    <label class="col-xs-3 col-lg-3 text-right">Bundle ID </label>
                    <label class="col-xs-9 col-lg-7"><input type="text" placeholder="Bundle ID" name="BundleID" value="{$info.iphonebundleid}"></label>
                </section>
                <div class="row"><label class="col-xs-3 col-lg-3 text-right"></label><label class="col-lg-3 hidden-sm hidden-xs" style="font-weight:100;">请务必填写您的苹果Bundle ID（Bundle identifier 是应用的标识符，表明应用和其他App的区别）</label></div>

				<?php
				}
				?>


				        <section class="row">
                    <label class="col-xs-3 col-lg-3 text-right">推广链接</label>

                    <label class="col-xs-9 col-lg-7 skb-rel">
                        <if condition="$result.isvip eq 1">
                            <input type="text"   name="shorturl"  readonly value="{$info.shorturl}" placeholder="短连接">
                            <else/>
                            <input type="text"   name="shorturl"   value="{$info.shorturl}" placeholder="短连接">
                        </if>



                        <span class="skb">www.qq6789.com</span>
                    </label>
                </section>
                <section class="row">
                    <label class="col-xs-3 col-lg-3 text-right">付费安装</label>
                    <label class="col-xs-9 col-lg-7">
                        <select class="pay-per-install" name="needmoney">
                            <option value="1" <if condition="$info.needmoney eq 1 ">selected</if>>￥0(免费,下载次数用尽后自动付费￥1安装)</option>
                            <option value="0" <if condition="$info.needmoney eq 0 ">selected</if>>￥0(免费,下载次数用尽后不能下载安装)</option>
                            <option value="6" <if condition="$info.needmoney eq 6 ">selected</if>>￥6</option>
                            <option value="12" <if condition="$info.needmoney eq 12 ">selected</if>>￥12</option>
                            <option value="18" <if condition="$info.needmoney eq 18 ">selected</if>>￥18</option>
                            <option value="25" <if condition="$info.needmoney eq 25 ">selected</if>>￥25</option>
                            <option value="30" <if condition="$info.needmoney eq 30 ">selected</if>>￥30</option>
                            <option value="40" <if condition="$info.needmoney eq 40 ">selected</if>>￥40</option>
                            <option value="45" <if condition="$info.needmoney eq 45 ">selected</if>>￥45</option>
                            <option value="50" <if condition="$info.needmoney eq 50 ">selected</if>>￥50</option>
                            <option value="60" <if condition="$info.needmoney eq 60 ">selected</if>>￥60</option>
                            <option value="68" <if condition="$info.needmoney eq 68 ">selected</if>>￥68</option>
                            <option value="88" <if condition="$info.needmoney eq 88 ">selected</if>>￥88</option>
                            <option value="98" <if condition="$info.needmoney eq 98 ">selected</if>>￥98</option>
                            <option value="128" <if condition="$info.needmoney eq 128 ">selected</if>>￥128</option>
                            <option value="256" <if condition="$info.needmoney eq 256 ">selected</if>>￥256</option>
                        </select>
                    </label>
                </section>
                <section class="row">
                    <label class="col-xs-3 col-lg-3 text-right">下载密码</label>
                    <label class="col-xs-9 col-lg-7"><input type="text" name="aqpassword" value="{$info.aqpassword}" placeholder="下载密码"></label>
                    <!-- <label class="col-lg-3 hidden-sm hidden-xs">设备密码后,用户安装应用要求输入密码</label> -->
                </section>
                <div class="row"><label class="col-xs-3 col-lg-3 text-right"></label><label class="col-lg-3 hidden-sm hidden-xs" style="font-weight:100">设备密码后,用户安装应用要求输入密码</label></div>
                <section class="row">
                    <label class="col-xs-3 col-lg-3 text-right">应用信息</label>
                    <label class="col-xs-9 col-lg-7"><textarea cols="20" rows="5" name="beifen" >{$info.beifen}</textarea></label>
                </section>
                <script>
                    var static = "__STATIC__";
                </script>
                <section class="img-box row">
                    <p class="up-p col-xs-3 col-lg-3 text-right">上传图片</p>
                    <label class="col-xs-9 col-lg-7">
                        <div class="z_photo upimg-div ">
                            <section class="z_file fl">
                                <img src="__STATIC__/images/a11.png" class="add-img">
                                <input type="file" name="file" id="file" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple />
                            </section>
                            <div class="clear"></div>
                        </div>
                    </label>
                </section>
                <aside class="mask works-mask">
                    <div class="mask-content">
                        <p class="del-p">您确定要删除作品图片吗？</p>
                        <p class="check-p"><span class="del-com wsdel-ok">确定</span><span class="wsdel-no">取消</span></p>
                    </div>
                </aside>
                <section class="row">
                    <label class="col-xs-3 col-lg-3 text-right">下载模板</label>
                    <label class="col-xs-9 col-lg-7">
                        <div class="includes">
                            <div class="mobanspan">
                                <a href="javascript:;" class="radio-bg on" value="0">
                                    <img src="__STATIC__/images/moban_1.png" width="100px"><br>
                                    <p>模板一</p>
                                    <span class="radio-bg-span"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-check fa-stack-1x fa-inverse"></i></span></span>
                                </a>
                            </div>
                            <div class="mobanspan">
                                <a href="javascript:;" class="radio-bg" value="1">
                                    <img src="__STATIC__/images/moban_1.png"  width="100px"><br>
                                    <p>模板二</p>
                                    <span class="radio-bg-span"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-check fa-stack-1x fa-inverse"></i></span></span>
                                </a>
                            </div>
                            <div class="mobanspan">
                                <a href="javascript:;" class="radio-bg" value="3">
                                     <img src="__STATIC__/images/moban_3.png"  width="100px"><br>
                                       <p>模板三</p>
                                       <span class="radio-bg-span"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-check fa-stack-1x fa-inverse"></i></span></span>
                                </a>
                            </div>
                        </div>
                    </label>
                </section>
                <section class="row">
                    <label class="col-xs-3 col-lg-3 text-right"><!--占位--></label>
                    <label class="col-xs-7 col-lg-7">
                        <input type="hidden" name="id" value="{$info.id}"/>
                        <input type="hidden" id="mobanid" name="mobanid" value="{$info.mobanid}"/>
                        <button type="submit" class="renewal-btn" id="submitButton">更新</button>
                    </label>
                </section>
            </section>

        </div>

    </div>
    </form>
</div>
<script>
    function copyArticle(event) {
        const range = document.createRange();
        range.selectNode(document.getElementById('generalize-url'));
        const selection = window.getSelection();
        if(selection.rangeCount > 0) selection.removeAllRanges();
        selection.addRange(range);
        document.execCommand('copy');
    }
    document.getElementById('copyBT').addEventListener('click', copyArticle, false);
</script>
<include file="Public/newset-footer" />

<script src="__STATIC__/js/imgUp.js"></script>
<script src="__STATIC__/js/cropper.js"></script>
<script src="__STATIC__/js/sitelogo.js"></script>
<script src="__STATIC__/js/html2canvas.min.js"></script>
<script>
//    //做个下简易的验证  大小 格式
//    $('#avatarInput').on('change', function(e) {
//        var filemaxsize = 1024 * 3;//5M
//        var target = $(e.target);
//        var Size = target[0].files[0].size / 1024;
//        console.log(Size);
//        if(Size > filemaxsize) {
//            alert('图片过大，请重新选择!');
//            $(".avatar-wrapper").childre().remove;
//            return false;
//        }
//        if(!this.files[0].type.match(/image.*/)) {
//            alert('请选择正确的图片!')
//        } else {
//            var filename = document.querySelector("#avatar-name");
//            var texts = document.querySelector("#avatarInput").value;
//            var teststr = texts; //你这里的路径写错了
//            console.log(teststr);
//            testend = teststr.match(/[^\\]+\.[^\(]+/i); //直接完整文件名的
//            filename.innerHTML = testend;
//        }
//    });
//    $(".avatar-save").on("click", function() {
//        var img_lg = document.getElementById('imageHead');
//        // 截图小的显示框内的内容
//        html2canvas(img_lg, {
//            allowTaint: true,
//            taintTest: false,
//            onrendered: function(canvas) {
//                canvas.id = "mycanvas";
//                //生成base64图片数据
//                var dataUrl = canvas.toDataURL("image/jpeg");
//                var newImg = document.createElement("img");
//                newImg.src = dataUrl;
//                imagesAjax(dataUrl)
//            }
//        });
//    })

    $(".radio-bg").each(function () {
        if ("{$info.mobanid}" == "0") {

            $(".radio-bg").removeClass("on");
            $(".radio-bg:eq(0)").addClass("on")
        }else if("{$info.mobanid}" == "1"){

            $(".radio-bg").removeClass("on");
            $(".radio-bg:eq(1)").addClass("on")
        }else if("{$info.mobanid}" == "3"){
            $(".radio-bg").removeClass("on");
            $(".radio-bg:eq(2)").addClass("on")
        }
    })
    $(function() {
        // 选择模版
        $(".radio-bg").click(function () {
            $(".radio-bg").removeClass("on");
            $(this).addClass("on")
            $("#mobanid").val($(this).attr("value"));
        })
        //  点击拷贝提示框
        $("#copyBT").click(function () {
            $(".hint-copy").fadeIn().delay(2000).fadeOut();
        })
    })
</script>

<script type="text/javascript">
    function fileSelect() {
        document.getElementById("fileToUpload").click();
    }
    function fileSelected() {
        $('#imgppp').show();
    }
</script>
